import cv2
image=cv2.imread('grad.png',cv2.IMREAD_GRAYSCALE)
cv2.imshow("Input",image)
kernel=cv2.getStructuringElement(cv2.MORPH_RECT,(3,3))
dilated_img1=cv2.erode(image,kernel,iterations=1)
cv2.imshow("Eroded(3*3)",dilated_img1)
kernel2=cv2.getStructuringElement(cv2.MORPH_RECT,(5,5))
dilated_img2=cv2.dilate(image,kernel,iterations=2)
cv2.imshow("2-dilate(3*3)",dilated_img2)
cv2.waitKey()
cv2.destroyWindow()